<template>
  <div class="dashboard-container">
    <div class="app-container">
      <el-card class="my-card">
        

        <el-alert type="info" class="el-icon-info" :title="'共'+total+'条消息'"></el-alert>

        <!-- 列表 -->
        <el-table :data="list" style="width: 100%">
          <el-table-column fixed prop="id" label="操作类型" width="280"  align="center">
          </el-table-column>
          <el-table-column prop="email" label="操作人" width="280" align="center">
          </el-table-column>
          <el-table-column prop="phone" label="执行结果" width="280" align="center">
          </el-table-column>
          <el-table-column prop="username" label="操作时间" width="280" align="center">
          </el-table-column>
          <el-table-column prop="permission_group_title" label="描述" align="center">
          </el-table-column>
        </el-table>

        <div class="block" style="float: right; margin: 20px">
          <!-- <span class="demonstration">完整功能</span> -->
          <el-pagination
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            :current-page="query.page"
            :page-sizes="[2, 4, 6, 8]"
            :page-size="query.pagesize"
            layout="total, sizes, prev, pager, next, jumper"
            :total="total"
          >
          </el-pagination>
        </div>
      </el-card>
      <addUsers ref="addUsers" @update-list="getappuser" ></addUsers>
      <dataUsers ref="dataUsers" @update-list="getappuser"></dataUsers>
    </div>
    
  </div>
</template>

<script>
import {getappuser,delappuser} from '@/api/users'
import addUsers from './components/add-users.vue'
import dataUsers from './components/data-users.vue'
export default {
  components:{addUsers,dataUsers},
  name: "articles",
  data() {
    return {
      dialogVisible: false,
      total:'',
      query: {
        page: 1,
        pagesize: 2,
        username:""
      },
      list:[],
      formInline: {
        user: "",
        region: "",
      },

    };
  },
  methods: {
    setonSubmit(){
      this.getappuser()
    },
      handleSizeChange(newPagesize) {
        this.query.pagesize = newPagesize
        this.getappuser()
      },
      handleCurrentChange(newPage) {
        console.log(newPage);
        this.query.page = newPage
        this.getappuser()
      },
    async getappuser() {
      let res = await getappuser(this.query)
      this.list=res.list
      this.total=res.counts
      console.log(res);
    },
    // handleClose(done) {
    //   this.$confirm('确认关闭？')
    //     .then(_ => {
    //       done();
    //     })
    //     .catch(_ => {});
    // }
    async delappuser(res){
        this.$confirm('确认删除？')
        .then(_ => {
          done();
        })
        .catch(_ => {});
      console.log(res);
      await delappuser(res)
              // 3. 成功提示，失败处理
      this.$message.success('删除成功')
      this.getappuser()
    },
    dateappuser(res){
      console.log(res);
      this.$refs.dataUsers.isShow = true;
      this.$refs.dataUsers.dataForm(res)
    }
  },
  created(){
    this.getappuser()
  }
};
</script>

<style lang="scss" scoped>
// [data-v-f70f99cc]
// [data-v-f70f99cc]
// my-card
.my-card[data-v-f70f99cc] .el-card__header {
  padding: 100px;
  border-bottom: 5px solid #ebeef5 !important;
}
.text {
  font-size: 14px;
}

.item {
  margin-bottom: 18px;
}

.clearfix:before,
.clearfix:after {
  display: table;
  content: "";
}
.clearfix:after {
  clear: both;
}

.box-card {
  width: 480px;
}
</style>
<style>
.my-card .el-card__header {
  padding-bottom: 0px;
  border-bottom: 0px solid #ebeef5 !important;
}
.my-card .el-card__body {
  padding-top: 0px;
}
.my-card .el-form-item {
  margin: 10px 0;
}
.my-card .el-alert {
  margin: 8px 0 16px;
}
.my-card .el-table__header-wrapper {
  border-bottom: 2px solid #e8e8e8;
  background-color: #fafafa;
}
.my-card th {
  background-color: #fafafa !important;
}
.my-card .my-btn {
  width: 95px;
  height: 32px;
  color: #fff;
  background-color: #67c23a;
  border-color: #67c23a;
}
.my-card .my-shou {
  width: 56px;
  height: 32px;
  padding: 0;
  line-height: 0;
  margin-left: 10px;
  background: #fff;
  border: 1px solid #dcdfe6;
  color: #606266;
}
.my-card .my-cha {
  width: 56px;
  height: 32px;
  padding: 0;
  line-height: 0;
}
.my-card .el-input__inner {
  height: 32px;
}
.my-card .my-item-two {
  margin-left: 40px;
}


</style>